use "dta\DataSet_v28.dta" , clear

************************************************************************
************************* SAMPLE RESTRICTION ***************************
************************************************************************
keep if inlist(party, "sv", "dna", "sp", "v", "krf", "h", "frp", "h_fv")
keep if year>1920
keep if year==first_year

****Many parties during this period introduced quotas requiring that all ballots should have at least 40% female candidates, including the Liberals (1974), The Socialist Left Party (1975), the Labor Party (1983), the Centre (1989), and the Christian Democratic Party (1993).

preserve
keep if party=="sv"
collapse female, by(year)
scatter female year, mcolor(black) connect(l) lcolor(gray) xlabel(1921(3)1936 1945(4)2021, labsize(tiny) angle(45)) plotregion(lcolor(white) ilcolor(white)) graphregion(color(white)) ylabel(,angle(0)) xtitle(Election year) ytitle(Fraction women) xline(1975,lcolor(gray) lpattern(dash) lwidth(thick)) yline(0.4,lcolor(gray) lpattern(shortdash)) title(Socialist Left (1975), color(black)) ylabel(0(0.1)0.6) scheme(s2mono)
graph save figures\gph\SV.gph, replace
restore

preserve
keep if party=="dna"
collapse female, by(year)
scatter female year, mcolor(black) connect(l) lcolor(gray) xlabel(1921(3)1936 1945(4)2021, labsize(tiny) angle(45)) plotregion(lcolor(white) ilcolor(white)) graphregion(color(white)) ylabel(,angle(0)) xtitle(Election year) ytitle(Fraction women) xline(1983,lcolor(gray) lpattern(dash) lwidth(thick)) yline(0.4,lcolor(gray) lpattern(shortdash)) title(Labor (1983), color(black)) ylabel(0(0.1)0.6) scheme(s2mono)
graph save figures\gph\DNA.gph, replace
restore

preserve
keep if party=="sp"
collapse female, by(year)
scatter female year, mcolor(black) connect(l) lcolor(gray) xlabel(1921(3)1936 1945(4)2021, labsize(tiny) angle(45)) plotregion(lcolor(white) ilcolor(white)) graphregion(color(white)) ylabel(,angle(0)) xtitle(Election year) ytitle(Fraction women) xline(1989,lcolor(gray) lpattern(dash) lwidth(thick)) yline(0.4,lcolor(gray) lpattern(shortdash)) title(Centre (1989), color(black)) ylabel(0(0.1)0.6) scheme(s2mono)
graph save figures\gph\SP.gph, replace
restore

preserve
keep if party=="v"
collapse female, by(year)
scatter female year, mcolor(black) connect(l) lcolor(gray) xlabel(1921(3)1936 1945(4)2021, labsize(tiny) angle(45)) plotregion(lcolor(white) ilcolor(white)) graphregion(color(white)) ylabel(,angle(0)) xtitle(Election year) ytitle(Fraction women) xline(1974,lcolor(gray) lpattern(dash) lwidth(thick)) yline(0.4,lcolor(gray) lpattern(shortdash)) title(Liberals (1974), color(black)) ylabel(0(0.1)0.6) scheme(s2mono)
graph save figures\gph\V.gph, replace
restore

preserve
keep if party=="krf"
collapse female, by(year)
scatter female year, mcolor(black) connect(l) lcolor(gray) xlabel(1921(3)1936 1945(4)2021, labsize(tiny) angle(45)) plotregion(lcolor(white) ilcolor(white)) graphregion(color(white)) ylabel(,angle(0)) xtitle(Election year) ytitle(Fraction women) xline(1993,lcolor(gray) lpattern(dash) lwidth(thick)) yline(0.4,lcolor(gray) lpattern(shortdash)) title(Christian Dem. (1993), color(black)) ylabel(0(0.1)0.6) scheme(s2mono)
graph save figures\gph\KRF.gph, replace
restore

preserve
keep if party=="h"|party=="h_fv"|party=="frp"
collapse female, by(year)
scatter female year, mcolor(black) connect(l) lcolor(gray) xlabel(1921(3)1936 1945(4)2021, labsize(tiny) angle(45)) plotregion(lcolor(white) ilcolor(white)) graphregion(color(white)) ylabel(,angle(0)) xtitle(Election year) ytitle(Fraction women) title(Cons. & Progress (-), color(black)) ylabel(0(0.1)0.6) yline(0.4,lcolor(gray) lpattern(shortdash)) scheme(s2mono)
graph save figures\gph\H.gph, replace
restore

cd figures\gph\
graph combine V.gph SV.gph DNA.gph SP.gph KRF.gph H.gph, ycommon xcommon plotregion(lcolor(white) ilcolor(white)) graphregion(color(white)) 
cd ..\..\
graph export figures\FigureA2.pdf, replace